<?php

namespace Module\Model;

use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

class UploadFormFilter implements InputFilterAwareInterface {

    public $fileupload;
    protected $inputfilter;

    public function exchangeArray($data) {
        $this->fileupload = isset($data['fileupload']) ? $data['fileupload'] : null;
    }

    public function setInputFilter(InputFilterInterface $inputFilter) {
        throw new \Exception('Not used');
    }

    public function getInputFilter() {
        if (!$this->inputfilter) {
            $inputFilter = new InputFilter();
            $factory = new InputFactory();

            $inputFilter->add(
                    $factory->createInput(array(
                        'name' => 'fileupload',
                        'required' => true,
                    ))
            );
            $this->inputfilter = $inputFilter;
        }

        return $this->inputfilter;
    }

}

?>